package com.itheima.config;

import org.springframework.context.annotation.Bean;
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
import org.springframework.transaction.PlatformTransactionManager;

import javax.sql.DataSource;

/**
 * ClassName:TranscationConfig
 * Package:com.itheima.config
 * Description:和事务相关的配置类
 * Date:2020/3/4 1:41
 * User: snow
 */
public class TransactionConfig {
	/**
	 * 创建事务管理器对象
	 * @param dataSource
	 * @return
	 */
	@Bean("transactionManager")
	public PlatformTransactionManager createTransactionManager(DataSource dataSource){
		return new DataSourceTransactionManager(dataSource);
	}
}


